#include "EpilForListStatementCode.h"
#include "EpilOutputHelper.h"
#include "TCharSupport.h"
#include "EpilPointerHelper.h"


EpilForListStatementCode::EpilForListStatementCode( const EpilLexLocation & location )
: EpilForStatementCodeBase( location )
{
}


EpilForListStatementCode::~EpilForListStatementCode()
{
	EpilPointerHelper::DeleteItemsAndClear( m_iterators );
}


tstring EpilForListStatementCode::ToEpilCode( int indent ) const
{
	tstringstream ret;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("for ");
	ret << EpilOutputHelper::GetListOutput( m_variables, t(", ") );
	ret << t(" in ");
	ret << EpilOutputHelper::GetListOutput( m_iterators, t(", ") );
	ret << t(" do");
	ret << endl;
	ret << this->GetBlock()->ToEpilCode( indent + 1 );
	ret << endl;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("end");
	return ret.str();
}